/**
 *
 * History:
 *   2010-7-4 23:06:49 Created by ZGong
 */
package gz.gae.blog.entity;

import com.google.appengine.api.datastore.Blob;
import com.google.appengine.api.datastore.Key;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.io.Serializable;

/**
 * Created by ZGong.
 *
 * @version 1.0 2010-7-4 23:06:49
 */
@Entity
public class Block
        implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Key key;
    Blob blob;

    public Key getKey() {
        return key;
    }

    public void setKey(Key key) {
        this.key = key;
    }

    public Blob getBlob() {
        return blob;
    }

    public void setBlob(Blob blob) {
        this.blob = blob;
    }

    public Block(byte[] buffer) {
        blob = new Blob(buffer);
    }

    public byte[] getBytes() {
        return blob.getBytes();
    }
}
